package com.taxshare.purchaser.controller;

import com.taxshare.purchaser.service.InvoiceAuthCollectService;
import com.taxshare.purchaser.view.dto.ElectronicLedgerDTO;
import com.taxshare.response.beans.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName: InvoiceAuthCollectController
 * @Description: 发票认证采集（手工提交、Excel导入）
 * @author: luozhongyi
 * @date: 2021/4/13 9:53
 */
@RestController
@RequestMapping(value = "/invoiceAuth/collect")
@Api(tags = "发票认证采集")
public class InvoiceAuthCollectController {

    @Autowired
    InvoiceAuthCollectService invoiceAuthCollectService;

    @PostMapping("/modifyValidTax")
    @ApiOperation(value = "修改有效税额", notes = "修改有效税额")
    public Response modifyValidTax(@RequestBody ElectronicLedgerDTO dto) {
        return invoiceAuthCollectService.modifyValidTax(dto);
    }

    @PostMapping("/add")
    @ApiOperation(value = "提交至待认证", notes = "提交至待认证")
    public Response add(@RequestBody ElectronicLedgerDTO dto) {
        return invoiceAuthCollectService.add(dto);
    }

    @PostMapping("/excelImport")
    @ApiOperation(value = "导入提交", notes = "导入提交")
    public Response excelImport(@RequestParam("file") MultipartFile excelFile) {
        return invoiceAuthCollectService.excelImport(excelFile);
    }

    @PostMapping("/cancel")
    @ApiOperation(value = "取消提交", notes = "取消提交")
    public Response cancel(@RequestBody ElectronicLedgerDTO dto) {
        return invoiceAuthCollectService.cancel(dto);
    }
}
